package com.jiazhong.boot.ioc.mybatis.mapper;

import com.jiazhong.boot.commons.bean.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("select * from emp where state=1")
    List<Emp> findAll();

    // @Select("select * from emp e left join dept d on e.deptno=d.deptno where state=1")
    List<Emp> find();

    @Insert("insert into emp values(null,#{ename},#{job},#{mgr},now(),#{sal},#{comm},#{deptNo},1) ")
    int save(Emp emp);

    @Delete("update emp set state=0 where empno=${id}")
    int removeById(int id);

}
